package string;
/** trim() 去除 */
public class TrimDemo {
    public static void main(String[] args) {
        String str = "   hello world   ";
        str = str.trim();//去除str两边的空白字符(一个新的字符串对象)，并存入str中
        System.out.println(str);//hello world

        String str1 = "  hello w y an   ";
        str1 = str1.trim();
        System.out.println(str1);
    }
}
